package com.example.nacos.sentinel.util;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.example.common.Result;

@Slf4j
public class ExceptionUtil {

    public static Result fallback(Integer id, Throwable e) {
        log.error("被异常降级啦,{}", e);
        return Result.error("-2", "===被异常降级啦===");
    }

    public static Result handleException(Integer id, BlockException e) {
        log.error("被限流啦,{}", e);
        return Result.error("-2", "===被限流啦===");
    }
}